//
//  Socket.h
//  CloudLive
//
//  Created by LuoLiuyou on 16/8/17.
//  Copyright © 2016年 Talkfun. All rights reserved.
//

#import <Foundation/Foundation.h>
@protocol TalkfunSocketDelegate <NSObject>
@optional


//代理方法 设置机器人时来到
- (void)updatememberTotal:(NSDictionary*)packet callback:(void (^)(NSDictionary* obj))callback;

//提问等等
- (BOOL)handle:(NSString *)event;
- (void)emit:(NSString *)event params:(NSMutableDictionary *)params callback:(void (^)(id))callback;

//统计
- (void)socket:(NSString *)url sid:(NSString *)socket_id status:(NSString *)status;
- (void)socket:(NSString *)url sid:(NSString *)socket_id status:(NSString *)status  number:(int )number;
- (void)sendAccessToken:(NSString*)accessToken print: (NSString*) path level: (int) level func: (NSString*) func line: (int) line str: (NSString*) str;
//行为记录代理
- (void)behaviorManagerPrint:(NSString*)print
              parameter:(NSDictionary *)parameter
                   line:(NSString*)line
                   func:(NSString*)func
              className:(NSString*)className;

/**
*     抽奖开始
*/
- (void)socketLotteryStart:(NSDictionary*)obj;
//抽奖结束
- (void)socketLotteryStop:(NSArray *)lotteryResult pub:(NSString*)pub gid:(NSString*)gid  currentXid:(NSString*)xid;
//抽奖结束2
-(void)socketLotteryStopforAll:(NSDictionary *)dict;


//小班全体互动
- (void)rtcGlobalstatus:(NSDictionary*)obj;

//为了不监听也走rtc 的方法, 如: 不监听上讲台, 但有权限sdk也能上讲台
- (void)rtcOn:(NSString *)event callback:(void (^)(NSDictionary* obj))callback result:(NSDictionary*)result1;
//没人设置block 监听, 也走代理返回数据
- (void)delegateCallback:(NSString *)event withParameter:(NSDictionary *)result;
@end
@interface TalkfunSocket : NSObject
@property (nonatomic, weak) id<TalkfunSocketDelegate> delegate;
@property (nonatomic,strong) NSMutableDictionary *listener;
@property (nonatomic,copy) NSString * networkStatusStr;

@property (nonatomic,assign) BOOL connected;
@property(nonatomic,assign) NSInteger timeInterval;//间隔的时候   7 *2
@property (nonatomic,copy) NSString *access_token;

@property (nonatomic,strong) NSDictionary *user;

@property(nonatomic, strong)NSString *sessionid;

@property (nonatomic,assign) NSInteger xid;

@property (nonatomic,strong) NSArray *addresses;

@property (nonatomic,assign) NSInteger memberTotal;//真人的数量

@property (nonatomic,assign) NSInteger robotCount;//机器人数量
@property (nonatomic,strong) NSMutableArray *memberList;//memberList //机器人的数据列表
@property (nonatomic,assign)BOOL robotSwitch;//是否开启机器人

@property (nonatomic,strong) NSString * userAgent;

@property (nonatomic,assign) BOOL log;
//是直播器
@property (nonatomic,assign) BOOL isLiveSDK;
@property (nonatomic,strong) NSString * avatarHost;

@property (nonatomic,strong) NSMutableDictionary * defaultAvatar;//头像
//访客-信息
@property(nonatomic,strong)NSMutableDictionary*visitorInfo;
//全部block
//@property (nonatomic,copy) void (^controlBlock)(NSString * method,id json);
@property(nonatomic,strong)NSMutableDictionary * online;
@property (nonatomic,assign) int currentIndex;
@property (nonatomic,assign)BOOL lecturer;//讲师的上下讲台处理,

+ (TalkfunSocket *)shared;

- (void)connect;

- (void)disconnect;

- (void)shutdown;

- (void)emit:(NSString *)event args:(NSMutableDictionary *)args;

- (void)emit:(NSString *)event args:(NSMutableDictionary *)args callback:(void (^)(id result))callback;

- (void)on:(NSString *)event callback:(void (^)(id result))callback;

- (void)off:(NSString *) event;

- (void)fire:(NSString *)event params:(id)response;
- (void)agoraKit:(NSString *)event params:(id)response ;

//获取头像urlString
- (NSString *)getAvatarString:(NSString *)xid avatarHost:(NSString *)avatarHost;

- (NSString*)getDecode:(NSString*)string;

//json转字典

- (NSDictionary *)dictionaryWithJsonString:(NSString *)jsonString;

- (NSDictionary *)getPacketDict:(NSDictionary*)paramsDatd;
- (NSString*)getAvatarUrl:(NSDictionary*)dict;


@end
